<template>
  <div>
      <photo-view :list="list" @close="close"/>
      <el-row style="margin-bottom: 5px">
          <p class="pinformation">仪器种类与描述</p>
          <p class="totalStyle">共 {{form.instrumentList.length}} 条数据</p>
      </el-row>
      <el-table :data="form.instrumentList" ref="yqTableRef" class="business" border>
        <el-table-column label="仪器种类" align="center" prop="instrumentTypeName" />
        <el-table-column label="仪器描述" align="center" prop="instrumentDesc" />
      </el-table>
  
      <el-row style="margin-bottom: 5px; margin-top: 5px">
          <p class="pinformation">仪器设备截图</p>
          <p class="totalStyle">共 {{form.yqFileList.length}} 条数据</p>
      </el-row>
      <el-table :data="form.yqFileList" class="business" border ref="sbTableRef">
        <el-table-column label="截图编号" align="center" width="220" prop="fileCode" />
        <el-table-column label="截图名称" align="center" >
          <template #default="scope">
              <span @click="list = scope.row.fileList" class="fileNameHover">{{scope.row.fileMc}}</span>
            </template>
          </el-table-column>
      </el-table>
  </div>
</template>

<script setup>
import useMethodStore from "@/store/modules/method";
const methodStore = useMethodStore();
const methodId = computed(() => methodStore.methodId);
const inseForm = computed(() => methodStore.inseForm);

const { proxy } = getCurrentInstance();
const { sys_instrument } = proxy.useShareDict("sys_instrument");

const data = reactive({
  form: { instrumentList: [], yqFileList: [] },
});

const { form } = toRefs(data);

const list = ref([])
function close() {
  list.value = []
}

watch(inseForm, () => {
  form.value = inseForm.value;
});

const heightParams = ref([{ tableName: "yq", bottomHeight: 250 },{ tableName: "sb", bottomHeight: 40 }]);
function getTableHeight() {
  proxy.adaptiveHeight(proxy, heightParams.value);
}

onMounted(() => {
  nextTick(function () {
    getTableHeight();
    window.addEventListener("resize", getTableHeight);
  })
})

onUpdated(() => {
  nextTick(function() {
    getTableHeight();
  });
});
onBeforeUnmount(() => {
  window.removeEventListener("resize", getTableHeight);
});
</script>
